home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / oath.lha / oath / test / dll1.cc < prev    next >
C/C++ Source or Header  |  1991-08-29  |  2KB  |  75 lines

  1. #include "oath/dlList.h"
  2.  
  3. #include "oath/character.h"
  4.  
  5. #include "oath/localToken.h"
  6.  
  7. #include <iostream.h>
  8.  
  9. /////////////////////////////////////////////////////////////////////////////
  10. // Test of dlLists
  11.  
  12. main ()
  13.    {// Part One ////////////////////
  14.  
  15.     tokenA T = localTokenA::make();
  16.  
  17.     characterA A = characterA::make('A');
  18.     characterA B = characterA::make('B');
  19.     characterA C = characterA::make('C');
  20.     characterA D = characterA::make('D');
  21.  
  22.     cout << A << B << C << D << endl;
  23.  
  24.     dlListA L1 = dlListA::make() << A << B << C;
  25.     dlListA L2 = dlListA::make() << A << B << C;
  26.     dlListA L3 = dlListA::make(L2);
  27.  
  28.     if(L1.is(L2) || L1.is(L3))
  29.         cout << "is() failed!" << endl;
  30.     else
  31.         cout << "is() succeeded!" << endl;
  32.  
  33.     if(L1 == L2 && L1 == L3)
  34.         cout << "== succeeded!" << endl;
  35.     else
  36.         cout << "== failed!" << endl;
  37.  
  38.     if(L1.isEmpty() || L2.isEmpty() || L3.isEmpty())
  39.         cout << "isEmpty() failed!" << endl;
  40.     else
  41.         cout << "isEmpty() succeeded!" << endl;
  42.  
  43.     if(L1.contains(A) && L1.contains(B) && !L1.contains(D))
  44.         cout << "contains() succeeded!" << endl;
  45.     else
  46.         cout << "contains() failed!" << endl;
  47.  
  48.     cout << "There are " << L1.count() << " characters in L1: ";
  49.     posA P1 = L1.makePos();
  50.     while(P1())
  51.        {cout << characterA::isa(*P1);
  52.         ++P1;
  53.        }
  54.     cout << endl;
  55.  
  56.     cout << "The second character is "
  57.          << characterA::isa(L1[1]) << endl;
  58.  
  59.     objA O;
  60.     L2 >> O;
  61.     cout << "The first character removed is " 
  62.          << characterA::isa(O) << endl;
  63.  
  64.     cout << "There are " << L2.count() << " characters in L2: ";
  65.     posA P2 = L2.makePos();
  66.     while(P2())
  67.        {cout << characterA::isa(*P2);
  68.         ++P2;
  69.        }
  70.     cout << endl;
  71.  
  72.    }
  73.  
  74.  
  75.